package com.atguigu.srb.core.controller.admin;

import com.atguigu.common.result.Result;
import com.atguigu.srb.core.pojo.entity.UserLoginRecord;
import com.atguigu.srb.core.service.UserLoginRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Administrator
 * @version 1.0
 * @description: TODO
 * @date 2021/7/19 0019 16:15
 */


@Api(tags = "登录日志")

@Slf4j
@RestController
@RequestMapping("/admin/core/userLoginRecord")
public class AdminUserLoginRecordController {

    @Autowired
    private UserLoginRecordService userLoginRecordService;

    @ApiOperation("登录日志")
    @GetMapping("/listTop50/{userId}")
    public Result listTop50(@ApiParam("用户登录日志")@PathVariable("userId") Long   userId){

        List<UserLoginRecord> userLoginRecords = userLoginRecordService.listTop50(userId);

        return Result.ok().data("list",userLoginRecords);
    }


}
